home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / obrn-a_1.5_lib.lha / oberon-a / source1.lha / source / amiga / GadTools.mod < prev    next >
Encoding:
Text File  |  1995-01-26  |  23.2 KB  |  688 lines

  1. (***************************************************************************
  2.  
  3.      $RCSfile: GadTools.mod $
  4.   Description: Interface to gadtools.library
  5.  
  6.    Created by: fjc (Frank Copeland)
  7.     $Revision: 3.7 $
  8.       $Author: fjc $
  9.         $Date: 1995/01/26 02:39:55 $
  10.  
  11.   Includes Release 40.15
  12.  
  13.   (C) Copyright 1989-1993 Commodore-Amiga, Inc.
  14.       All Rights Reserved
  15.  
  16.   Oberon-A interface Copyright © 1994-1995, Frank Copeland.
  17.   This file is part of the Oberon-A Interface.
  18.   See Oberon-A.doc for conditions of use and distribution.
  19.  
  20. ***************************************************************************)
  21.  
  22. <* STANDARD- *> <* INITIALISE- *> <* MAIN- *>
  23. <*$ CaseChk-  IndexChk- LongVars+ NilChk-  *>
  24. <*$ RangeChk- StackChk- TypeChk-  OvflChk- *>
  25.  
  26. MODULE [2] GadTools;
  27.  
  28. IMPORT
  29.   SYS := SYSTEM, Kernel, e := Exec, u := Utility, gfx := Graphics,
  30.   i := Intuition, s := Sets;
  31.  
  32.  
  33. (*
  34. **      $VER: gadtools.h 39.9 (19.8.92)
  35. **
  36. **      gadtools.library definitions
  37. *)
  38.  
  39. (* -----------------------------------------------------------------------*)
  40.  
  41. (*  The kinds (almost classes) of gadgets in the toolkit.  Use these
  42.     identifiers when calling CreateGadgetA() *)
  43.  
  44. CONST
  45.  
  46.   genericKind *    = 0;
  47.   buttonKind *     = 1;
  48.   checkBoxKind *   = 2;
  49.   integerKind *    = 3;
  50.   listViewKind *   = 4;
  51.   mxKind *         = 5;
  52.   numberKind *     = 6;
  53.   cycleKind *      = 7;
  54.   paletteKind *    = 8;
  55.   scrollerKind *   = 9;
  56. (* Kind number 10 is reserved *)
  57.   sliderKind *     = 11;
  58.   stringKind *     = 12;
  59.   textKind *       = 13;
  60.  
  61.   numKinds *       = 14;
  62.  
  63. (* -----------------------------------------------------------------------*)
  64.  
  65. CONST
  66.  
  67. (*  'Or' the appropriate set together for your Window IDCMPFlags: *)
  68.  
  69.   arrowIDCMP *      = { i.gadgetUp, i.gadgetDown, i.intuiTicks,
  70.                         i.mouseButtons };
  71.  
  72.   buttonIDCMP *     = { i.gadgetUp };
  73.   checkBoxIDCMP *   = { i.gadgetUp };
  74.   integerIDCMP *    = { i.gadgetUp };
  75.   listViewIDCMP *   = { i.gadgetUp, i.gadgetDown, i.mouseMove }
  76.                       + arrowIDCMP;
  77.  
  78.   mxIDCMP *         = { i.gadgetDown };
  79.   numberIDCMP *     = {};
  80.   cycleIDCMP *      = { i.gadgetUp };
  81.   paletteIDCMP *    = { i.gadgetUp };
  82.  
  83. (*  Use ArrowIDCMP + ScrollerIDCMP if your scrollers have arrows: *)
  84.   scrollerIDCMP *   = { i.gadgetUp, i.gadgetDown, i.mouseMove };
  85.   sliderIDCMP *     = { i.gadgetUp, i.gadgetDown, i.mouseMove };
  86.   stringIDCMP *     = { i.gadgetUp };
  87.  
  88.   textIDCMP *       = {};
  89.  
  90. (* -----------------------------------------------------------------------*)
  91.  
  92. TYPE
  93.  
  94.   VisualInfo * = POINTER TO RECORD END;
  95.  
  96. (*  Generic NewGadget used by several of the gadget classes: *)
  97.  
  98.   NewGadgetPtr * = POINTER TO NewGadget;
  99.   NewGadget * = RECORD
  100.     leftEdge *,
  101.     topEdge *    : INTEGER;         (*  gadget position *)
  102.     width *,
  103.     height *     : INTEGER;         (*  gadget size *)
  104.     gadgetText * : e.LSTRPTR;       (*  gadget label *)
  105.     textAttr *   : gfx.TextAttrPtr; (*  desired font for gadget label *)
  106.     gadgetID *   : e.UWORD;         (*  gadget ID *)
  107.     flags *      : s.SET32;         (*  see below *)
  108.     visualInfo * : VisualInfo;      (*  Set to retval of GetVisualInfo() *)
  109.     userData *   : e.APTR;          (*  gadget UserData *)
  110.   END; (* NewGadget *)
  111.  
  112.  
  113. CONST
  114.  
  115. (* flags control certain aspects of the gadget.  The first five control
  116.  * the placement of the descriptive text.  Each gadget kind has its default,
  117.  * which is usually placeTextLeft.  Consult the autodocs for details.
  118.  *)
  119.  
  120.   placeTextLeft *  = 0;  (* Right-align text on left side *)
  121.   placeTextRight * = 1;  (* Left-align text on right side *)
  122.   placeTextAbove * = 2;  (* Center text above *)
  123.   placeTextBelow * = 3;  (* Center text below *)
  124.   placeTextIn *    = 4;  (* Center text on *)
  125.  
  126.   highLabel *      = 5;  (* Highlight the label *)
  127.  
  128. (* -----------------------------------------------------------------------*)
  129.  
  130. TYPE
  131.  
  132. (* Fill out an array of these and pass that to CreateMenus(): *)
  133.  
  134.   NewMenuPtr * = POINTER TO NewMenu;
  135.   NewMenu * = RECORD
  136.     type *          : SHORTINT; (*  See below *)
  137.     (* Compiler inserts a PAD byte here *)
  138.     label *         : e.LSTRPTR; (*  Menu's label *)
  139.     commKey *       : e.LSTRPTR; (*  MenuItem Command Key Equiv *)
  140.     flags *         : s.SET16;  (*  Menu or MenuItem flags (see note) *)
  141.     mutualExclude * : s.SET32;  (*  MenuItem MutualExclude word *)
  142.     userData *      : e.APTR;   (*  For your own use, see note *)
  143.   END; (* NewMenu *)
  144.  
  145. CONST
  146.  
  147. (* Needed only by inside im* definitions below *)
  148.   menuImage * = -128;
  149.  
  150. (* type determines what each NewMenu structure corresponds to.
  151.  * for the nmTitle, nmItem, and nmSub values, label should
  152.  * be a text string to use for that menu title, item, or sub-item.
  153.  * For imItem or imSub, set label to point at the Image structure
  154.  * you wish to use for this item or sub-item.
  155.  * NOTE: At present, you may only use conventional images.
  156.  * Custom images created from Intuition image-classes do not work.
  157.  *)
  158.   title *        = 1;
  159.   item *         = 2;
  160.   sub *          = 3;
  161.  
  162.   imItem *         = item + menuImage;
  163.   imSub *          = sub  + menuImage;
  164.  
  165. (* The NewMenu array should be terminated with a NewMenu whose
  166.  * type equals nmEnd.
  167.  *)
  168.   end * = 0;                  (* End of NewMenu array *)
  169.  
  170. (* Starting with V39, GadTools will skip any NewMenu entries whose
  171.  * ype field has the nmIgnore bit set.
  172.  *)
  173.   ignore * = 64;
  174.  
  175.  
  176. (* nm_Label should be a text string for textual items, a pointer
  177.  * to an Image structure for graphical menu items, or the special
  178.  * constant nmBarlabel, to get a separator bar.
  179.  *)
  180.   barLabel *     = SYS.VAL(e.LSTRPTR, -1);
  181.  
  182.  
  183. (*  The nmFlags field is used to fill out either the Menu.flags or
  184.     MenuItem.flags field.  Note that the sense of the menuEnabled or
  185.     itemEnabled bit is inverted between this use and Intuition's use,
  186.     in other words, NewMenus are enabled by default.  The following
  187.     labels are provided to disable them: *)
  188.   menuDisabled * = i.menuEnabled;
  189.   itemDisabled * = i.itemEnabled;
  190.  
  191. (* New for V39:  nmCommandString.  For a textual MenuItem or SubItem,
  192.  * point commKey at an arbitrary string, and set the nmCommandString
  193.  * flag.
  194.  *)
  195.   commandString * = i.commSeq;
  196.  
  197. (* The following are pre-cleared (commSeq, itemText, and highxxx are set
  198.  * later as appropriate):
  199.  * Under V39, the commSeq flag bit is not cleared, since it now has
  200.  * meaning.
  201.  *)
  202.   flagMask *     = -({i.commSeq, i.itemText} + i.highFlags);
  203.   flagMaskV39 *  = -({i.itemText} + i.highFlags);
  204.  
  205.  
  206. (*  You may choose among checkIt, menuToggle, and checked.
  207.     Toggle-select menuitems are of type checkIt | menuToggle, along
  208.     with checked if currently selected.  Mutually exclusive ones
  209.     are of type checkIt, and possibly checked too.  The nmMutualExclude
  210.     is a bit-wise representation of the items excluded by this one,
  211.     so in the simplest case (choose 1 among n), these flags would be
  212.     ~1, ~2, ~4, ~8, ~16, etc.  See the Intuition Menus chapter. *)
  213.  
  214. (* A UserData pointer can be associated with each Menu and MenuItem structure.
  215.  * The CreateMenus() call allocates space for a UserData after each
  216.  * Menu or MenuItem (header, item or sub-item).  You should use the
  217.  * GTMENU_USERDATA() or GTMENUITEM_USERDATA() macro to extract it.
  218.  *)
  219.  
  220. (*
  221. #define GTMENU_USERDATA(menu) ( * ( (APTR * )(((struct Menu * )menu)+1) ) )
  222. #define GTMENUITEM_USERDATA(menuitem) ( * ( (APTR * )(((struct MenuItem * )menuitem)+1) ) )
  223.  
  224. (* Here is an old one for compatibility.  Do not use in new code! *)
  225. #define MENU_USERDATA(menuitem) ( * ( (APTR * )(menuitem+1) ) )
  226. *)
  227.  
  228. (*  These return codes can be obtained through the gtmnSecondaryError tag *)
  229.   gtMenuTrimmed *  = 00000001H;      (* Too many menus, items, or subitems,
  230.                                            menu has been trimmed down *)
  231.   gtMenuInvalid *  = 00000002H;      (* Invalid NewMenu array *)
  232.   gtMenuNoMem *    = 00000003H;      (* Out of memory *)
  233.  
  234. (*------------------------------------------------------------------------*)
  235.  
  236. (* Starting with V39, checkboxes and mx gadgets can be scaled to your
  237.  * specified gadget width/height.  Use the new cbScaled or mxScaled
  238.  * tags, respectively.  Under V37, and by default in V39, the imagery
  239.  * is of the following fixed size:
  240.  *)
  241.  
  242. CONST
  243.  
  244. (* MX gadget default dimensions: *)
  245.   mxWidth * = 17;
  246.   mxHeight * = 9;
  247.  
  248. (* Checkbox default dimensions: *)
  249.   checkboxWidth * = 26;
  250.   checkboxHeight * = 11;
  251.  
  252. (* -----------------------------------------------------------------------*)
  253.  
  254. CONST
  255.  
  256. (* Tags for GadTools functions: *)
  257.  
  258.   tagBase *           = u.user + 80000H;
  259.  
  260.   viNewWindow *       = tagBase+1;  (* Unused *)
  261.   viNWTags *          = tagBase+2;  (* Unused *)
  262.  
  263.   Private0            = tagBase+3;  (* (private) *)
  264.  
  265.   cbChecked *         = tagBase+4;  (* State of checkbox *)
  266.  
  267.   lvTop *             = tagBase+5;  (* Top visible one in listview *)
  268.   lvLabels *          = tagBase+6;  (* List to display in listview *)
  269.  
  270.   noList * = SYS.VAL(e.ListPtr,-1); (* for short list locking (see RKMs) *)
  271.  
  272.   lvReadOnly *        = tagBase+7;  (* TRUE if listview is to be
  273.                                      * read-only
  274.                                      *)
  275.   lvScrollWidth *     = tagBase+8;  (* Width of scrollbar *)
  276.  
  277.   mxLabels *          = tagBase+9;  (* NULL-terminated array of labels *)
  278.   mxActive *          = tagBase+10; (* Active one in mx gadget *)
  279.  
  280.   txText *            = tagBase+11; (* Text to display *)
  281.   txCopyText *        = tagBase+12; (* Copy text label instead of
  282.                                      * referencing it
  283.                                      *)
  284.  
  285.   nmNumber *          = tagBase+13; (* Number to display *)
  286.  
  287.   cyLabels *          = tagBase+14; (* NULL-terminated array of labels *)
  288.   cyActive *          = tagBase+15; (* The active one in the cycle gad *)
  289.  
  290.   paDepth *           = tagBase+16; (* Number of bitplanes in palette *)
  291.   paColor *           = tagBase+17; (* Palette color *)
  292.   paColorOffset *     = tagBase+18; (* First color to use in palette *)
  293.   paIndicatorWidth *  = tagBase+19; (* Width of current-color indicator *)
  294.   paIndicatorHeight * = tagBase+20; (* Height of current-color indicator *)
  295.  
  296.   scTop *             = tagBase+21; (* Top visible in scroller *)
  297.   scTotal *           = tagBase+22; (* Total in scroller area *)
  298.   scVisible *         = tagBase+23; (* Number visible in scroller *)
  299.   scOverlap *         = tagBase+24; (* Unused *)
  300.  
  301. (*  tagBase+25 through tagBase+37 are reserved *)
  302.  
  303.   slMin *             = tagBase+38; (* Slider min value *)
  304.   slMax *             = tagBase+39; (* Slider max value *)
  305.   slLevel *           = tagBase+40; (* Slider level *)
  306.   slMaxLevelLen *     = tagBase+41; (* Max length of printed level *)
  307.   slLevelFormat *     = tagBase+42; (* Format string for level *)
  308.   slLevelPlace *      = tagBase+43; (* Where level should be placed *)
  309.   slDispFunc *        = tagBase+44; (* Callback for number calculation
  310.                                      * before display
  311.                                      *)
  312.  
  313.   stString *          = tagBase+45; (* String gadget's displayed string *)
  314.   stMaxChars *        = tagBase+46; (* Max length of string *)
  315.  
  316.   inNumber *          = tagBase+47; (* Number in integer gadget *)
  317.   inMaxChars *        = tagBase+48; (* Max number of digits *)
  318.  
  319.   mnTextAttr *        = tagBase+49; (* MenuItem font TextAttr *)
  320.   mnFrontPen *        = tagBase+50; (* MenuItem text pen color *)
  321.  
  322.   bbRecessed *        = tagBase+51; (* Make BevelBox recessed *)
  323.  
  324.   visualInfo *        = tagBase+52; (* result of VisualInfo call *)
  325.  
  326.   lvShowSelected *    = tagBase+53; (* show selected entry beneath
  327.                 * listview, set tag data = NULL for display-only, or pointer
  328.                 * to a string gadget you've created
  329.                 *)
  330.   lvSelected *        = tagBase+54; (* Set ordinal number of selected
  331.                                      * entry in the list
  332.                                      *)
  333.   Reserved1           = tagBase+56; (* Reserved for future use *)
  334.  
  335.   txBorder *          = tagBase+57; (* Put a border around
  336.                                      * Text-display gadgets
  337.                                      *)
  338.   nmBorder *          = tagBase+58; (* Put a border around
  339.                                      * Number-display gadgets
  340.                                      *)
  341.  
  342.   scArrows *          = tagBase+59; (* Specify size of arrows for
  343.                                      * scroller
  344.                                      *)
  345.  
  346.   mnMenu *            = tagBase+60; (* Pointer to Menu for use by
  347.                                      * LayoutMenuItems()
  348.                                      *)
  349.   mxSpacing *         = tagBase+61; (* Added to font height to
  350.                 * figure spacing between mx choices.  Use this instead
  351.                 * of layoutaSpacing for mx gadgets.
  352.                 *)
  353.  
  354. (* New to V37 GadTools.  Ignored by GadTools V36 *)
  355.   fullMenu *        = tagBase+62; (* Asks CreateMenus() to
  356.                 * validate that this is a complete menu structure
  357.                 *)
  358.   secondaryError *  = tagBase+63; (* tiData is a pointer
  359.                 * to a ULONG to receive error reports from CreateMenus()
  360.                 *)
  361.   underscore *        = tagBase+64; (* tiData points to the symbol
  362.                 * that preceeds the character you'd like to underline in a
  363.                 * gadget label
  364.                 *)
  365.   stEditHook *        = tagBase+55; (* String EditHook *)
  366.   inEditHook * = stEditHook;           (* Same thing, different name,
  367.                 * just to round out integerKind gadgets
  368.                 *)
  369.  
  370. (* New to V39 GadTools.  Ignored by GadTools V36 and V37 *)
  371.   mnCheckmark *    = tagBase+65;  (* data is checkmark img to use *)
  372.   mnAmigaKey *     = tagBase+66;  (* data is Amiga-key img to use *)
  373.   mnNewLookMenus * = tagBase+67;  (* data is boolean *)
  374.  
  375. (* New to V39 GadTools.  Ignored by GadTools V36 and V37.
  376.  * Set to TRUE if you want the checkbox or mx image scaled to
  377.  * the gadget width/height you specify.  Defaults to FALSE,
  378.  * for compatibility.
  379.  *)
  380.   cbScaled *        = tagBase+68;  (* data is boolean *)
  381.   mxScaled *        = tagBase+69;  (* data is boolean *)
  382.  
  383.   paNumColors *     = tagBase+70;  (* Number of colors in palette *)
  384.  
  385.   mxTitlePlace *    = tagBase+71;  (* Where to put the title *)
  386.  
  387.   txFrontPen *      = tagBase+72;  (* Text color in textKind gad *)
  388.   txBackPen *       = tagBase+73;  (* Bgrnd color in textKind gad *)
  389.   txJustification * = tagBase+74;  (* See j#? constants *)
  390.  
  391.   nmFrontPen *      = tagBase+72;  (* Text color in numberKind gad *)
  392.   nmBackPen *       = tagBase+73;  (* Bgrnd color in numberKind gad *)
  393.   nmJustification * = tagBase+74;  (* See j#? constants *)
  394.   nmFormat *        = tagBase+75;  (* Formatting string for number *)
  395.   nmMaxNumberLen *  = tagBase+76;  (* Maximum length of number *)
  396.  
  397.   bbFrameType *     = tagBase+77;  (* defines what kind of boxes
  398.                                     * DrawBevelBox() renders. See
  399.                                     * the bbft#? constants for
  400.                                     * possible values
  401.                                     *)
  402.  
  403.   lvMakeVisible *   = tagBase+78;  (* Make this item visible *)
  404.   lvItemHeight *    = tagBase+79;  (* Height of an individual item *)
  405.  
  406.   slMaxPixelLen *   = tagBase+80;  (* Max pixel size of level display *)
  407.   slJustification * = tagBase+81;  (* how should the level be displayed *)
  408.  
  409.   paColorTable *    = tagBase+82;  (* colors to use in palette *)
  410.  
  411.   lvCallBack *      = tagBase+83;  (* general-purpose listview call back *)
  412.   lvMaxPen *        = tagBase+84;  (* maximum pen number used by call back *)
  413.  
  414.   txClipped *       = tagBase+85;  (* make a textKind clip text *)
  415.   nmClipped *       = tagBase+85;  (* make a numberKind clip text *)
  416.  
  417. (* Old definition, now obsolete: *)
  418.   Reserved0 *       = stEditHook;
  419.  
  420. (*------------------------------------------------------------------------*)
  421.  
  422. (* Justification types for txJustification and nmJustification tags *)
  423.   jLeft * = 0;
  424.   jRight * = 1;
  425.   jCenter * = 2;
  426.  
  427. (*------------------------------------------------------------------------*)
  428.  
  429. (* Bevel box frame types for bbFrameType tag *)
  430.   bbftButton * = 1;         (* Standard button gadget box *)
  431.   bbftRidge * = 2;          (* Standard string gadget box *)
  432.   bbftIconDropBox * = 3;    (* Standard icon drop box     *)
  433.  
  434. (* -----------------------------------------------------------------------*)
  435.  
  436. CONST
  437.  
  438. (*  Typical suggested spacing between "elements": *)
  439.   interWidth *      = 8;
  440.   interHeight *     = 4;
  441.  
  442. (* -----------------------------------------------------------------------*)
  443.  
  444. CONST
  445.  
  446. (*  "NWay" is an old synonym for cycle gadgets *)
  447.   nWAYKind *     = cycleKind;
  448.   nWAYIDCMP *    = cycleIDCMP;
  449.   nwLabels *     = cyLabels;
  450.   nwActive *     = cyActive;
  451.  
  452.  
  453. (*------------------------------------------------------------------------*)
  454.  
  455. (* These two definitions are obsolete, but are here for backwards
  456.  * compatibility.  You never need to worry about these:
  457.  *)
  458.   gadToolBit * = 15;
  459. (* Use this mask to isolate the user part: *)
  460.   gadToolMask * = -{gadToolBit};
  461.  
  462. (*------------------------------------------------------------------------*)
  463.  
  464. (* These definitions are for the LV_CallBack tag *)
  465.  
  466. (* The different types of messages that a listview callback hook can see *)
  467.   lvDraw * = 0202H;            (* draw yourself, with state *)
  468.  
  469. (* Possible return values from a callback hook *)
  470.   lvcbOk * = 0;                 (* callback understands this message type    *)
  471.   lvcbUnknown * = 1;            (* callback does not understand this message *)
  472.  
  473. (* states for LVDrawMsg.state *)
  474.   lvrNormal * = 0;              (* the usual                 *)
  475.   lvrSelected * = 1;            (* for selected gadgets      *)
  476.   lvrNormalDisabled * = 2;               (* for disabled gadgets      *)
  477.   lvrSelectedDisabled * = 8;             (* disabled and selected     *)
  478.  
  479. TYPE
  480.  
  481. (* structure of lvDraw messages, object is an Exec.NodePtr *)
  482.   LVDrawMsg * = RECORD (i.MsgBase)
  483.     msg *      : i.Msg;            (* lvDraw                    *)
  484.     rastPort * : gfx.RastPortPtr;  (* where to render to        *)
  485.     drawInfo * : i.DrawInfoPtr;    (* useful to have around     *)
  486.     bounds *   : gfx.Rectangle;    (* limits of where to render *)
  487.     state *    : e.ULONG;          (* how to render             *)
  488.   END;
  489.  
  490.  
  491. (**-- Library Base variable --------------------------------------------*)
  492.  
  493. CONST
  494.  
  495.   gadtoolsName * = "gadtools.library";
  496.  
  497. VAR
  498.  
  499.   base * : e.LibraryPtr;
  500.  
  501.  
  502. (**-- Library Functions ------------------------------------------------*)
  503.  
  504. (*
  505. **      $VER: gadtools_protos.h 39.2 (24.3.92)
  506. *)
  507.  
  508. (* --- functions in V36 or higher (distributed as Release 2.0) ---*)
  509.  
  510. (* Gadget Functions *)
  511.  
  512. PROCEDURE CreateGadgetA* [base,-30]
  513.   ( kind     [0] : e.ULONG;
  514.     gad      [8] : i.GadgetPtr;
  515.     VAR ng   [9] : NewGadget;
  516.     taglist [10] : ARRAY OF u.TagItem )
  517.   : i.GadgetPtr;
  518. PROCEDURE CreateGadget* [base,-30]
  519.   ( kind     [0]   : e.ULONG;
  520.     gad      [8]   : i.GadgetPtr;
  521.     VAR ng   [9]   : NewGadget;
  522.     taglist [10].. : u.Tag )
  523.   : i.GadgetPtr;
  524. PROCEDURE FreeGadgets* [base,-36]
  525.   ( gad [8] : i.GadgetPtr );
  526. PROCEDURE SetGadgetAttrsA* [base,-42]
  527.   ( VAR gad  [8] : i.Gadget;
  528.     win      [9] : i.WindowPtr;
  529.     req     [10] : i.RequesterPtr;
  530.     taglist [11] : ARRAY OF u.TagItem );
  531. PROCEDURE SetGadgetAttrs* [base,-42]
  532.   ( VAR gad  [8]   : i.Gadget;
  533.     win      [9]   : i.WindowPtr;
  534.     req     [10]   : i.RequesterPtr;
  535.     taglist [11].. : u.Tag );
  536.  
  537. (* Menu functions *)
  538.  
  539. PROCEDURE CreateMenusA* [base,-48]
  540.   ( newmenu [8] : ARRAY OF NewMenu;
  541.     taglist [9] : ARRAY OF u.TagItem )
  542.   : i.MenuPtr;
  543. PROCEDURE CreateMenus* [base,-48]
  544.   ( newmenu [8]   : ARRAY OF NewMenu;
  545.     taglist [9].. : u.Tag )
  546.   : i.MenuPtr;
  547. PROCEDURE CreateMenusAB* [base,-48]
  548.   ( newmenu [8] : NewMenuPtr;
  549.     taglist [9] : ARRAY OF u.TagItem )
  550.   : i.MenuPtr;
  551. PROCEDURE CreateMenusB* [base,-48]
  552.   ( newmenu [8]   : NewMenuPtr;
  553.     taglist [9].. : u.Tag )
  554.   : i.MenuPtr;
  555. PROCEDURE FreeMenus* [base,-54]
  556.   ( menu [8] : i.MenuPtr );
  557. PROCEDURE LayoutMenuItemsA* [base,-60]
  558.   ( firstitem [8] : i.MenuItemPtr;
  559.     vi        [9] : VisualInfo;
  560.     taglist  [10] : ARRAY OF u.TagItem )
  561.   : BOOLEAN;
  562. PROCEDURE LayoutMenuItems* [base,-60]
  563.   ( firstitem [8]   : i.MenuItemPtr;
  564.     vi        [9]   : VisualInfo;
  565.     taglist  [10].. : u.Tag )
  566.   : BOOLEAN;
  567. PROCEDURE LayoutMenusA* [base,-66]
  568.   ( firstmenu [8] : i.MenuPtr;
  569.     vi        [9] : VisualInfo;
  570.     taglist  [10] : ARRAY OF u.TagItem )
  571.   : BOOLEAN;
  572. PROCEDURE LayoutMenus* [base,-66]
  573.   ( firstmenu [8]   : i.MenuPtr;
  574.     vi        [9]   : VisualInfo;
  575.     taglist  [10].. : u.Tag )
  576.   : BOOLEAN;
  577.  
  578. (* Misc Event-Handling Functions *)
  579.  
  580. PROCEDURE GetIMsg* [base,-72]
  581.   ( iport [8] : e.MsgPortBasePtr )
  582.   : i.IntuiMessagePtr;
  583. PROCEDURE ReplyIMsg* [base,-78]
  584.   ( imsg [9] : i.IntuiMessageBasePtr );
  585. PROCEDURE RefreshWindow* [base,-84]
  586.   ( win [8] : i.WindowPtr;
  587.     req [9] : i.RequesterPtr );
  588. PROCEDURE BeginRefresh* [base,-90]
  589.   ( win [8] : i.WindowPtr );
  590. PROCEDURE EndRefresh* [base,-96]
  591.   ( win      [8] : i.WindowPtr;
  592.     complete [0] : i.LONGBOOL );
  593. PROCEDURE FilterIMsg* [base,-102]
  594.   ( imsg [9] : i.IntuiMessageBasePtr )
  595.   : i.IntuiMessagePtr;
  596. PROCEDURE PostFilterIMsg* [base,-108]
  597.   ( imsg [8] : i.IntuiMessageBasePtr )
  598.   : i.IntuiMessagePtr;
  599. PROCEDURE CreateContext* [base,-114]
  600.   (  VAR glistptr [8] : i.GadgetPtr )
  601.   : i.GadgetPtr;
  602.  
  603. (* Rendering Functions *)
  604.  
  605. PROCEDURE DrawBevelBoxA* [base,-120]
  606.   ( rport   [8] : gfx.RastPortPtr;
  607.     left    [0] : LONGINT;
  608.     top     [1] : LONGINT;
  609.     width   [2] : LONGINT;
  610.     height  [3] : LONGINT;
  611.     taglist [9] : ARRAY OF u.TagItem );
  612. PROCEDURE DrawBevelBox* [base,-120]
  613.   ( rport   [8]   : gfx.RastPortPtr;
  614.     left    [0]   : LONGINT;
  615.     top     [1]   : LONGINT;
  616.     width   [2]   : LONGINT;
  617.     height  [3]   : LONGINT;
  618.     taglist [9].. : u.Tag );
  619.  
  620. (* Visuals Functions *)
  621.  
  622. PROCEDURE GetVisualInfoA* [base,-126]
  623.   ( screen  [8] : i.ScreenPtr;
  624.     taglist [9] : ARRAY OF u.TagItem )
  625.   : VisualInfo;
  626. PROCEDURE GetVisualInfo* [base,-126]
  627.   ( screen  [8]   : i.ScreenPtr;
  628.     taglist [9].. : u.Tag )
  629.   : VisualInfo;
  630. PROCEDURE FreeVisualInfo* [base,-132]
  631.   ( vi [8] : VisualInfo );
  632.  
  633. (*--- functions in V39 or higher (Release 3) ---*)
  634.  
  635. PROCEDURE GetGadgetAttrsA* [base,-174]
  636.   ( gad      [8] : i.GadgetPtr;
  637.     win      [9] : i.WindowPtr;
  638.     req     [10] : i.RequesterPtr;
  639.     taglist [11] : ARRAY OF u.TagItem )
  640.   : LONGINT;
  641. PROCEDURE GetGadgetAttrs* [base,-174]
  642.   ( gad      [8]  : i.GadgetPtr;
  643.     win      [9]  : i.WindowPtr;
  644.     req     [10]  : i.RequesterPtr;
  645.     taglist [11]..: u.Tag )
  646.   : LONGINT;
  647.  
  648.  
  649. (**-- C Macros defined as procedures -----------------------------------*)
  650.  
  651. <*$LongVars+*>
  652.  
  653. (*  A UserData pointer can be associated with each Menu and MenuItem structure.
  654.     The CreateMenus() call allocates space for a UserData after each
  655.     Menu or MenuItem (header, item or sub-item).  You should use the
  656.     gtMenuUSERDATA() or gtMenuitemUSERDATA() macro to extract it. *)
  657.  
  658. (**-----------------------------------*)
  659. PROCEDURE [0] MenuUserData * (menu : i.MenuPtr) : e.APTR;
  660.  
  661. BEGIN (* MenuUserData *)
  662.   RETURN SYS.VAL (e.APTR, SYS.VAL (LONGINT, menu) + SIZE (i.Menu))
  663. END MenuUserData;
  664.  
  665. (**-----------------------------------*)
  666. PROCEDURE [0] MenuItemUserData * (menuitem : i.MenuItemPtr) : e.APTR;
  667.  
  668. BEGIN (* MenuItemUserData *)
  669.   RETURN
  670.     SYS.VAL (e.APTR, SYS.VAL (LONGINT, menuitem) + SIZE (i.MenuItem))
  671. END MenuItemUserData;
  672.  
  673. (**-- Library Base variable --------------------------------------------*)
  674.  
  675. <*$LongVars-*>
  676.  
  677. (**-----------------------------------*)
  678. PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
  679.  
  680. BEGIN (* CloseLib *)
  681.   IF base # NIL THEN e.CloseLibrary (base) END
  682. END CloseLib;
  683.  
  684. BEGIN
  685.   base := e.OpenLibrary (gadtoolsName, e.libraryMinimum);
  686.   IF base # NIL THEN Kernel.SetCleanup (CloseLib) END
  687. END GadTools.
  688.